package com.wing.purchase.dao;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wing.purchase.model.entity.PurchaseDeliveryRecord;
import com.wing.purchase.model.response.PurchaseDeliveryRecordVO;
import com.wing.purchase.model.response.SupplierWaybillVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 供应商发货记录-Dao
 *
 * @author
 */
@Mapper
public interface PurchaseDeliveryRecordDao extends BaseMapper<PurchaseDeliveryRecord> {

    /**
     * 列表-app
     *
     * @param params
     *
     * @return
     */
    List<PurchaseDeliveryRecordVO> list4app(@Param("params") Map<String, Object> params);

    /**
     * 分页列表-app
     *
     * @param page
     * @param params
     *
     * @return
     */
    List<PurchaseDeliveryRecordVO> list4app(@Param("page") Page<PurchaseDeliveryRecordVO> page, @Param("params") Map<String, Object> params);

    /**
     * 详情-app
     *
     * @param id
     *
     * @return
     */
    PurchaseDeliveryRecordVO get4appById(Long id);

    /**
     * 查询采购订单的产品是否全部发货
     * @param orderId
     * @return
     */
    boolean isAllDelivery(Long orderId);

    /**
     * 查询供应商下的运单
     * @param supplierId
     * @return
     */
    List<SupplierWaybillVo> getWaybillInfoBy(@Param("supplierId") String supplierId);

    /**
     * 改变状态为已签收
     * @param purchaseDeliveryRecordId
     * @return
     */
    int updatePurchaseDeliveryStatus(@Param("purchaseDeliveryRecordId") Long purchaseDeliveryRecordId,@Param("status") String status);

    /**
     * 供应商发货记录详情
     * @param id
     * @return
     */
    PurchaseDeliveryRecordVO detail(@Param("id") Long id,@Param("databaseUser") String databaseUser);
}
